package cn.com.huzo.repository.master.impl;

import cn.com.huzo.model.entities.master.MaterialGroupMemberMaterialEntity;
import huzofw.repository.impl.GenericRepositoryImpl;
import huzofw.repository.impl.MyBatisDaoUtils;
import java.util.HashMap;
import java.util.List;
import org.springframework.stereotype.Repository;
import cn.com.huzo.repository.master.MaterialGroupMemberMaterialRepository;
import java.util.Map;

/**
 * 材料在材料组数据访问对象。
 *
 * @author 吴旭
 */
@Repository("MaterialGroupMemberMaterialRepository")
public class MaterialGroupMemberMaterialRepositoryImpl extends GenericRepositoryImpl<MaterialGroupMemberMaterialEntity, HashMap>
        implements MaterialGroupMemberMaterialRepository {

    private final String namespace = "cn.com.huzo.repository.master.MaterialGroupMemberMaterialRepository";

    /**
     * 构造函数,设置the entity to MaterialGroupRepositoryImpl.class.
     */
    public MaterialGroupMemberMaterialRepositoryImpl() {
        super(MaterialGroupMemberMaterialEntity.class);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<MaterialGroupMemberMaterialEntity> fetchByMaterialKey(Long materialKey) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchByMaterialKey"), materialKey);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchInsert(List<MaterialGroupMemberMaterialEntity> itemList) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchInsert"), itemList);

    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer delete(Map<String, Object> criterion) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "delete"), criterion);
    }
}
